using IQIGame.Onigao.Game;

namespace IQIGame.Onigao.Logic
{
    public class LgEntityReturnToPostComponent : LogicBaseEntityComponent
    {
        internal Vector3Logic chaseStartPos;
        internal Vector3Logic chaseStartDir;
        private LevelEntity _entity;

        public override uint MaxStore => 50;
        public bool isRunning => _entity != null && _entity.navigator.isNavigating;

        public override void Awake(BaseEntity entity)
        {
            _entity = entity as LevelEntity;
        }

        public void Start(Vector3Logic targetPoint)
        {
            _entity.StartNavigation(targetPoint);
        }

        public override void LogicOnUpdate()
        {

        }

        public override void OnRelease()
        {
            if (_entity.navigator.isNavigating)
            {
                _entity.StopNavigation();
            }
            _entity = null;
        }
    }
}
